# include <cstdio>
# include <iostream>
# include <cstring>
# define MAXN 10023
using namespace std;

int sum[MAXN], n, m;
int MaxSum[MAXN];

int main() { 
    memset(MaxSum, 0x80, sizeof(MaxSum));
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= n; i++) { 
        int x;
        scanf("%d", &x);
        sum[i] = sum[i - 1] + x;
    }
    for(int i = n; i >= 1; i--) { 
        MaxSum[i] = MaxSum[i + 1];
        for(int j = 1; j + i - 1 <= n; j++) { 
            MaxSum[i] = max(MaxSum[i], sum[j + i - 1] - sum[j - 1]);
        }
    }
    for(int i = 1; i <= m; i++) { 
        int x;
        scanf("%d", &x);
        printf("%d\n", MaxSum[x]);
    }
}
